package org.springblade.core.tool.datamask;

import com.fasterxml.jackson.databind.introspect.Annotated;
import com.fasterxml.jackson.databind.introspect.NopAnnotationIntrospector;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class DataMaskingAnnotationIntrospector extends NopAnnotationIntrospector {

	@Override
	public Object findSerializer(Annotated am) {
		DataMasking annotation = am.getAnnotation(DataMasking.class);
		if (annotation != null) {
			return new DataMaskingSerializer(annotation.maskFunc().operation(), annotation.maskChar(), annotation.maskRange());
		}
		return null;
	}

}
